home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-02-24 | 1.4 KB | 77 lines | [TEXT/PJMM] |
- unit MyGrowZones;
-
- { This code is part of the Finger/Fingerd source code, written in THINK Pascal 4 }
- { Copyright 1991-1992 Peter N Lewis }
- { If you use this code, you must give me credit in your about box and documentation }
- { This is part of my generic library of routines }
-
- interface
-
- procedure InitGrowZone (alertid: integer);
- procedure FinishGrowZone;
- procedure GrowZoneIdle;
- function MemoryCritical: boolean;
-
- implementation
-
- uses
- BaseGlobals;
-
- var
- gzh: handle;
- lastgzh: handle;
- id: integer;
-
- function MyGrowZone (size: longInt): longInt;
- begin
- if gzh <> nil then begin
- MyGrowZone := GetHandleSize(gzh);
- DisposHandle(gzh);
- gzh := nil;
- end
- else
- MyGrowZone := 0;
- end;
-
- procedure GrowZoneIdle;
- var
- t, c: longInt;
- a: integer;
- begin
- if gzh = nil then begin
- PurgeSpace(t, c);
- if c > growzone_size then
- gzh := NewHandle(growzone_size);
- if (gzh = nil) and (lastgzh <> nil) then begin
- SetCursor(arrow);
- a := Alert(id, nil);
- end;
- lastgzh := gzh;
- end;
- end;
-
- function MemoryCritical: boolean;
- begin
- MemoryCritical := gzh = nil;
- end;
-
- {$S Init}
- procedure InitGrowZone (alertid: integer);
- begin
- id := alertid;
- SetGrowZone(@MyGrowZone);
- gzh := nil;
- lastgzh := nil;
- GrowZoneIdle;
- end;
-
- {$S Term}
- procedure FinishGrowZone;
- begin
- if gzh <> nil then begin
- DisposHandle(gzh);
- gzh := nil;
- end;
- end;
-
- end.